{extend name='admin@main'}

{block name="button"}

{/block}

<style>
.nowrap{ white-space:pre-wrap !important;	}
</style>

{block name="content"}
<div class="think-box-shadow">
    {include file='cooperate/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>

            <th class='text-left nowrap' >用户信息</th>

            <th class='text-left nowrap' >合作模式</th>

            <th class='text-left nowrap' style="width: 100px;">姓名</th>
            <th class='text-left nowrap' >电话</th>

            <th class='text-left nowrap' >添加时间</th>
            <th class='text-left nowrap' >审核状态</th>
            <th class='text-left nowrap' >审核时间</th>
            <th class='text-left nowrap' >属性</th>
            <th class='text-left nowrap' >操作</th>


        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>

            <td class='text-left nowrap'><span style="line-height: 60px">{$vo.id|default='--'}</span></td>
            <td class='text-left ' >{$vo.user.username|default='--'}<br>{$vo.user.phone|default='--'}</td>

            <td class='text-left ' >{$vo.cooperate_type|default='--'}</td>

            <td class='text-left ' >{$vo.username|default='--'}</td>
            <td class='text-left ' >{$vo.phone|default='--'}</td>

            <td class='text-left ' >{$vo.create_at|default='--'}</td>

            <td class='text-left ' >{$vo.status_r|raw|default='--'}</td>
            <td class='text-left ' >{$vo.audit_at|default='--'}</td>

            <td class="text-left">
                <select id="type{$vo.id}" class="type" data-id="{$vo.id}">
                    <option value="0" <?php if($vo['type']==0){ echo 'selected'; } ?>>未选择</option>
                    <option value="1" <?php if($vo['type']==1){ echo 'selected'; } ?>>物业</option>
                    <option value="2" <?php if($vo['type']==2){ echo 'selected'; } ?>>个人</option>
                    <option value="3" <?php if($vo['type']==3){ echo 'selected'; } ?>>联营</option>
                    <option value="4" <?php if($vo['type']==4){ echo 'selected'; } ?>>非联营</option>
                </select><br><br>
                {if auth("store/cooperate/edit_ziduan")}
                <span style="cursor: pointer; color: blue" onclick="queding('{$vo.id}')">&nbsp;&nbsp;确&nbsp;定&nbsp;&nbsp;</span>
                {else}
                <a data-tips-text="您没有编辑的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">编 辑</a>
                {/if}
            </td>
            <td class='text-left'>




                <?php if($vo['status']!=2){ ?>

                <!--{if auth("store/cooperate/forbid")}-->
<!--                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}"-->
<!--                   data-value="id#{$vo.id}">审核驳回</a>-->
                <!--{else}-->
<!--                <a data-tips-text="您没有驳回的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">审核驳回</a>-->
                <!--{/if}-->

                <?php } ?>

<!--                <br><br>-->

                <?php if($vo['status']!=1){ ?>
                <!--{if auth("store/cooperate/resume")}-->
                <a class="layui-btn layui-btn-sm " data-action="{:url('resume')}"
                   data-value="id#{$vo.id}">审核成功</a>
                <!--{else}-->
                <a data-tips-text="您没有审核成功的权限哦！"
                   class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">审核成功</a>
                <!--{/if}-->
                <?php } ?>


            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    <script>
        function queding(id) {
            var val = $("#type" + id).val();
            $.ajax({
                url: "<?php echo url('store/cooperate/edit_ziduan');?>",
                type: "post",
                data: {"id": id, 'ziduan': 'type', 'val': val},
                success: function (data) {
                    alert('操作成功')
                    window.location.reload();
                }
            })
        }
    </script>
</div>
{/block}
